<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .c1{
            color:red;
        }
        .c2{
            color:green;
        }
        .s1{
            color:yellow;
        }
        .s2{
            border:1px solid black;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <template id="txt">
        <div>
            <p>{{username}}</p>
            <p v-html="html"></p>
            <!-- 用来解析html -->
            <p :class="style">hello vue</p>
            <!-- 可以改后面属性的值 -->
            <p>{{a>1?username:style}}</p>
            <p v-bind:class="a>4?style:'c2'">哈哈</p>
            <p v-if="flag">显示</p>
            <button @click=say()>click</button>
            <p :class="{s1:flag,s2:flag}">sdasdadadadsada</p>
            <p :class="['s1','s2']">sdadadadsada</p>
            <p :style="{color:'blue',border:'1px solid red',fontSize:'20px'}">陷阱</p>
        </div>
    </template>
</body>
<script src="/vue.min.js"></script>
<script>
    var vm=new Vue({
        el:'#app',
        template:'#txt',
        data:function(){
            return{
                username:'make',
                html:'<b>hell0</b>',
                style:'c1' ,
                a:2 ,
                flag:true
            }
        },
        methods:{
            say:function(){
                alert('hello')
            }
        }
    })
</script>
</html>